package com.commons.tools.utils;

import javax.servlet.http.*;
import java.net.*;

public class ResponseUtils {

    public static void setResponseDownloadProp(HttpServletResponse response, String fileName) throws Exception{
        response.setHeader("content-type", "application/octet-stream");
        response.setContentType("application/octet-stream");
        response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
        response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName,"utf-8"));
        response.setCharacterEncoding("UTF-8");
    }
}
